<?
	$assessment = $dsfm_common->get("assessment", "id=".$_POST['id']);

	$re['common1'] = $_POST['common1'];
	$sql = "SELECT target FROM common WHERE id = ".$_POST['common1'];
	$common1 = $db->queryUniqueValue($sql);

	$re['common2'] = $_POST['common2'];
	$sql = "SELECT target FROM common WHERE id = ".$_POST['common2'];
	$common2 = $db->queryUniqueValue($sql);
	

	if($common2 != 0 &&  $assessment['percent'] != 0) {

		if($assessment['unit'] == 1){
			$re['result'] = ($common1 / $common2);
		}else{
			$re['result'] = ($common1 / $common2)*100;
		}

		$re['result1'] = $re['result'] * 5 / $assessment['percent'];
		$re['evaluation'] = round($re['result1']);
	}



//	$re['evaluation'] = $dsfm_common->evaluation($result, $assessment);
	$re['target'] = $_POST['target'];
	$re['indicator'] = $_POST['indicator'];
	$re['collector'] = $_POST['collector'];
	$re['project'] = $_POST['project'];

	$db->update("assessment", $re, "id=".$_POST['id']);

	redirect("assessment.php?id=".$id);
?>